﻿<%@ Page Title="正则表达式详细信息" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="ViewRegex.aspx.cs" Inherits="RegexLib.Web.Views.Regex.ViewRegex" %>
<asp:Content ID="Content1" ContentPlaceHolderID="headContentPlaceHolder" runat="server">
	<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/container/assets/skins/sam/container.css"/>
	<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.5.2/build/button/assets/skins/sam/button.css"/>
	<link rel="Stylesheet" type="text/css" href="/Content/styles/RxView.css"/>
</asp:Content>
<asp:Content ContentPlaceHolderID="metaKeywordPlaceHolder" runat="server">
		<meta name="keywords" content="<%= ViewData["MetaKeywords"] %>">
		<meta name="description" content="<%= ViewData["MetaDescription"] %>">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<% UserRegex regex = (UserRegex)ViewData["Regex"]; %>
<% RegexUserKeyword[] authorKeywords = (RegexUserKeyword[])ViewData["AuthorKeywords"]; %>
<% RegexUserKeyword[] userKeywords = (RegexUserKeyword[])ViewData["UserKeywords"]; %>
<% string visitor = (string)ViewData["Visitor"]; %>
<input type="hidden" id="Visitor" value="<%= visitor %>" />
<div class="box">
	<div class="bt">正则表达式详细信息</div>
	<div class="bc">
		<h3 class="rx-title"><%= HttpUtility.HtmlEncode(regex.Title) %></h3>
		<p>发布者：<a href='<%= RxUrl.GetUserUrl(regex.UserAccessKey) %>'><%= HttpUtility.HtmlEncode(regex.Nickname) %></a></p>
		<p class="rx-des"><%= HttpUtility.HtmlEncode(regex.Description) %></p>
		<textarea class="rx-pattern" cols="200" readonly="readonly"><%= regex.Pattern %></textarea>
		<p><a href='<%= "/Regex/Test/?id=" + regex.RegexId.ToString("N") %>'>测试该正则表达式</a></p>
		<p>关键字：
			<span id="AuthorKeywordSpan">
<% if (authorKeywords != null && authorKeywords.Length > 0) %>
<% { %>
	<% for (int i = 0; i < authorKeywords.Length; i++ ) %>
	<% { %>
			<a href='<%= RxUrl.GetViewKeywordUrl(authorKeywords[i].Text) %>'><%= HttpUtility.HtmlEncode(authorKeywords[i].Text) %></a>
			<% if (visitor == "author") %>
			<% { %>
				<a href="javascript:DelKeyword('<%= authorKeywords[i].KeywordId %>')" title="删除"><img src="/Content/images/del.gif" alt="删除" /></a>
			<% } %>

			<% if (i < authorKeywords.Length - 1) %>
			<% { %>
				|
			<% } %>
	<% } %>
<% } %>
<% else %>
<% { %>
		暂无。
<% } %>
			</span>
<% if (visitor == "author") %>
<% { %>
	[<a href="javascript:doAddKeywords()" title="添加">添加</a>]
<% } %>
		</p>
<% if (visitor == "user") %>
<% { %>
		<p>我的关键字：<span id="UserKeywordSpan">
	<% if (userKeywords != null && userKeywords.Length > 0) %>
	<% { %>
		<% for (int i = 0; i < userKeywords.Length; i++) %>
		<% { %>
			<a href='<%= RxUrl.GetViewKeywordUrl(userKeywords[i].Text) %>'><%= HttpUtility.HtmlEncode(userKeywords[i].Text)%></a>
			<a href="javascript:DelKeyword('<%= userKeywords[i].KeywordId %>')" title="删除"><img src="/Content/images/del.gif" alt="删除" /></a>
			<% if (i < userKeywords.Length - 1) %>
			<% { %>
				|
			<% } %>
		<% } %>
	<% } %>
	<% else %>
	<% { %>
		暂无。
	<% } %>
	</span>
	[<a href="javascript:doAddKeywords()" title="添加">添加</a>]
		</p>
<% } %>

<% if (visitor == "author") %>
<% { %>
		<p class="cmd-r"><a href='<%= "/Regex/Edit/?regexId=" + regex.RegexId %>'>编辑正则表达式</a></p>
<% } %>
		<div class="ad-c"><%= RxAdsUtility.GetAdsCode("inpage") %></div>
	</div>
</div>
<div class="box">
	<div class="bt">发表评论</div>
	<div class="bc">
		<input type="hidden" id="RegexId" name="regexId" value="<%= regex.RegexId %>" />
<% if (RxMembership.IsUserLoggedIn()) %>
<% { %>
		<form id="CommentForm">
			<input type="hidden" name="regexId" value="<%= regex.RegexId %>" />
			<table>
				<tr><td>评论内容：</td><td><textarea name="commentBody" class="rx-comment"></textarea></td></tr>
			</table>
		</form>
		<p><button id="SubmitBtn">发表评论</button></p>
		<p><span id="MsgSpan"></span></p>
<% } %>
<% else %>
<% { %>
		<p>请先<a href='<%= "/Member/Login/?ReturnUrl=" + HttpUtility.UrlEncode(Request.RawUrl) %>'>登录</a>再发表评论。</p>
<% } %>
	</div>
</div>
<div class="box">
	<div class="bt">用户评论</div>
	<div class="bc" id="CommentPanel">
	</div>
</div>
<div id="AddKeywordsDialog">
	<div class="hd">添加关键字</div>
	<div class="bd">
		<p class="ds">请输入关键字。</p>
		<p class="ds">多个关键字之间请用全角或半角的<strong>逗号</strong>（“,”、“，”）或<strong>分号</strong>（“;”、“；”）分隔。空格<strong>不能</strong>分隔关键字。单个关键字的长度请限制在50字之内。</p>
		<form id="AddKeywordsForm" action="/Regex/AddKeywords/">
			<input type="hidden" name="regexId" value="<%= regex.RegexId %>" />
			<input type="text" name="keywords" style="width:100%" class="input" />
		</form>
	</div>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptPlaceHolder" runat="server">
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/dragdrop/dragdrop-min.js"></script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/element/element-beta-min.js"></script>  
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/button/button-min.js"></script>  
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/container/container-min.js"></script>  
<script type="text/javascript" src="/Content/script/rxview.js"></script>
</asp:Content>
